package server.servlet;

import server.common.Request;
import server.common.Response;
import server.utils.HttpProtocolUtil;

import java.io.IOException;

/**
 * @Author: Dengxh
 * @Date: 2020/12/29 2:51
 * @Description:
 */
public class DemoServlet2 extends HttpServlet{
    @Override
    public void doGet(Request request, Response response) {
        String content = "<h1>DemoServlet2</h1>";
        try {
            response.output((HttpProtocolUtil.getHttpHeader200(content.getBytes().length) + content));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void doPost(Request request, Response response) {
        String content = "<h1>DemoServlet2</h1>";
        try {
            response.output((HttpProtocolUtil.getHttpHeader200(content.getBytes().length) + content));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
